package com.company.structural.facade_pattern.subsystem;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * 文件保存
 * @ClassName FileWriter
 * @Author tiezheng.han
 * @Date 2020/9/1 10:30
 **/
public class FileWriter {

    public void write(String encryptStr,String fileNameDes){
        System.out.println("保密文件，写入文件");
        try {
            FileOutputStream outputStream = new FileOutputStream(fileNameDes);
            outputStream.write(encryptStr.getBytes());
            outputStream.close();
        } catch (FileNotFoundException e) {
            System.out.println("文件不存在！");
        } catch (IOException e) {
            System.out.println("文件操作失误！");
        }

    }
}
